
package com.kweative.model.query;

import com.kweative.model.Table;
import java.sql.SQLException;
import java.util.LinkedList;

/**
 *
 * @author henrik
 */
abstract public class Statement<T extends Table> {
    private T table;
    protected LinkedList<Phrase<?>> phrases = new LinkedList<Phrase<?>>();

    public Statement(T primTable) {
        this.table = primTable;
    }

    public T getTable() {
        return table;
    }
    abstract public String compile();

    public int execute() throws SQLException {
        return getTable().getConnection().createStatement().executeUpdate(compile());
    }
}
